TryAggregateRootEventHandler   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 9
dl 0
loc 10
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A handle 0 3 1
1
/* tslint:disable:max-classes-per-file */
2
import { EventsHandler, IEventHandler } from '@nestjs/cqrs';
3
import { Storage } from '../storage/storage';
4
import { SagaEvent, TryAggregateRootEvent } from '../events/test.events';
5
6
@EventsHandler(TryAggregateRootEvent)
7
export class TryAggregateRootEventHandler implements IEventHandler<TryAggregateRootEvent> {
8
    constructor(
9
        private readonly storage: Storage
10
    ) {
11
    }
12
13
    handle(event: TryAggregateRootEvent) {
14
        this.storage.upsert('TryAggregateRootEvent', event.message);
15
    }
16
}
17
18
@EventsHandler(SagaEvent)
19
export class SagaEventHandler implements IEventHandler<SagaEvent> {
20
    constructor(
21
        private readonly storage: Storage
22
    ) {
23
    }
24
25
    handle(event: SagaEvent) {
26
        this.storage.upsert('SagaEventHandler', event.message);
27
    }
28
}
29